from lib.tencent.translate import Translate as tencent_translate
import re


class OpText:

    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
                "input": ("STRING", {"default": ""}),
                "content": ("STRING", {"multiline": True, "default": ""}),
                "accept": ("BOOLEAN", {"default": True}),
            }
        }

    RETURN_TYPES = ("STRING",)
    RETURN_NAMES = ("text",)

    FUNCTION = "handle"

    OUTPUT_NODE = False

    CATEGORY = "fcl/op_text"

    history_dict = {}

    def handle(self, input="", content="", accept=True):
        if input != "" and accept:
            content = input
        return {
            "ui": {
                "string": [
                    content,
                ]
            },
            "result": (content,),
        }


NODE_CLASS_MAPPINGS = {"FCL_OP_TEXT": OpText}

NODE_DISPLAY_NAME_MAPPINGS = {"FCL_OP_TEXT": "fcl operator text"}
